<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
namespace App\Service\Setting;

use App\Models\CombustionIntegral;
use App\Models\GroupOrderSetting;
use App\Service\BaseService;

class GroupSettingService extends BaseService
{
    public function getSetting($key = null)
    {
        $gs = GroupOrderSetting::query()->first();
        if ($key) {
            return $gs->{$key};
        }
        return $gs;
    }

    /**
     * 增加燃烧量.
     * @param mixed $number
     * @param null|mixed $description
     */
    public function increaseTheAmountOfCombustion($number = 1, $description = null)
    {
        $number = round($number, 2);
        CombustionIntegral::query()->create([
            'quantity' => $number,
            'description' => $description,
        ]);
    }
}
